<?php

namespace Desktopd\MUA;


// Encoding (not about a charset, which must always be UTF-8)
abstract class Encoding {
    private $encoded = '';
    
    public function __construct ($encoded) {
        $this->encoded = is_string($encoded) ? $encoded : "$encoded";
    }
    
    final public function getEncoded () {
        return $this->encoded;
    }
    
    public function __toString () {
        return $this->getEncoded();
    }
    
    // returns the decoded data
    abstract public function decode ();
    
    // returns a new instance with the encoded data
    abstract public static function encode ($plain);
    
}


// vim: ts=4 et ai

